package com.ui.BRVAH;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.orangelife.R;

import java.util.ArrayList;
import java.util.List;

/**
 * CymChad/BaseRecyclerViewAdapterHelper:
 * BRVAH:Powerful and flexible RecyclerAdapter
 * https://github.com/CymChad/BaseRecyclerViewAdapterHelper
 */
public class BrvahActivity extends AppCompatActivity {

    private RecyclerView rv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_brvah);
        initView();
        setAdapter();
    }

    private void initView() {
        rv = findViewById(R.id.rv);
        //设置布局管理器
        rv.setLayoutManager(new LinearLayoutManager(this));
    }

    private void setAdapter() {
        MySectionAdapter adapter = new MySectionAdapter(
                R.layout.ui_brvah_item_content,
                R.layout.ui_brvah_item_head,
                getData());
        rv.setAdapter(adapter);
    }

    private List<MySectionEntity> getData() {
        List<MySectionEntity> list = new ArrayList<>();
        list.add(new MySectionEntity(true, "7月账单"));
        list.add(new MySectionEntity(new MyEntity("110.00元")));
        list.add(new MySectionEntity(new MyEntity("120.00元")));
        list.add(new MySectionEntity(new MyEntity("130.00元")));
        list.add(new MySectionEntity(new MyEntity("140.00元")));
        list.add(new MySectionEntity(new MyEntity("150.00元")));
        list.add(new MySectionEntity(true, "8月账单"));
        list.add(new MySectionEntity(new MyEntity("210.00元")));
        list.add(new MySectionEntity(new MyEntity("220.00元")));
        list.add(new MySectionEntity(new MyEntity("230.00元")));
        list.add(new MySectionEntity(true, "9月账单"));
        list.add(new MySectionEntity(new MyEntity("310.00元")));
        list.add(new MySectionEntity(new MyEntity("320.00元")));
        list.add(new MySectionEntity(new MyEntity("330.00元")));
        return list;
    }

}



